package com.start_eternity.oasissafewalk.mapper;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.start_eternity.oasissafewalk.pojo.Parent;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * author:ZhangT
 * Date:2024 / 03 / 13 / 11:03
 * Description:
 */
@Mapper
public interface ParentMapper extends BaseMapper<Parent>{

    //插入数据
    public int insert(Parent parent);

    //修改家长的基本个人数据
    public int update(Parent parent);

    //账户删除
    public int delById(@Param("pId") Integer pId);

    //分页查询
    public List<Parent> queryPage(@Param("page") int page,@Param("pageSize") int pageSize);

    //根据id查询
    public Parent queryByPId(@Param("pId") Integer pId);

    //  查询家长关联的学生信息
    public List<Parent> queryListByPId(@Param("pId") Integer pId);

    //查询是否 存在该 openId 的用户
    @Select("select * from `Parent` where openId = #{openId}")
    public Parent selOpenId(@Param("openId") String openId);

    //查询是否 存在该 openId 的用户
    @Select("select p_id from `Parent` where openId = #{openId}")
    public int idByOpenId(@Param("openId") String openId);

    //根据家长id和学生id确定orderNo内容
    @Select("select order_no from `order` where parent_id = #{pId} AND s_id = #{sId}")
    public String selDetails(@Param("pId") Integer pId, @Param("sId") Integer sId);
    //测试
    public List<Parent> Test(@Param("pId") Integer pId);

}
